package top.shaozuo.simple.user.jmx;

import java.util.HashSet;
import java.util.Set;

public class BlockEmails implements BlockEmailsMBean {

    private Set<String> emails = new HashSet<>();

    @Override
    public String[] getBlockEmails() {
        return emails.toArray(new String[0]);
    }

    @Override
    public void addBlockEmail(String email) {
        emails.add(email);
    }

    @Override
    public void removeBlockEmail(String email) {
        emails.remove(email);
    }

    @Override
    public boolean shouldBlock(String email) {
        return emails.contains(email);
    }

}
